<template>
    <view class="page" :style="themeColor">

 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout"   >
            <view   class='flex flex-wrap align-center justify-center bandMobile_fd0_0'     >
        <image class='bandMobile_fd0_0_c0' mode="aspectFit"  :src='STATIC_URL+"2.png"'></image>
</view>
    <view   class='flex flex-wrap align-center bandMobile_fd0_1'     >
        <image class='bandMobile_fd0_1_c0' mode="aspectFit"  :src='STATIC_URL+"3.png"'></image>
<input class='flex-sub bandMobile_fd0_1_c1'  type="number" placeholder="请输入手机号" confirm-type="done" :maxlength="11" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx"  v-model="account" />
</view>
    <view   class='flex flex-wrap align-center bandMobile_fd0_2'     >
        <image class='bandMobile_fd0_1_c0' mode="aspectFit"  :src='STATIC_URL+"5.png"'></image>
<input class='flex-sub bandMobile_fd0_1_c1'  type="number" placeholder="请输入验证码" confirm-type="done" :maxlength="4" placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx"  v-model="code" />
<benben-send-verification-code class='flex  bandMobile_fd0_2_c2' after-text='后重新获取' before-text='获取验证码' type='5'  :phone="account"></benben-send-verification-code>
</view>
    <view   class='flex flex-wrap align-center bandMobile_fd0_2'     >
        <image class='bandMobile_fd0_1_c0' mode="aspectFit"  :src='STATIC_URL+"4.png"'></image>
<benben-flex-password-diy v-model="password" class-name="flex align-center flex-sub flex bandMobile_fd0_3_c1" :placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true' placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx" >
      <template #show>
        <text class='fu-iconfont2  bandMobile_fd0_3_c1_icon1'  data-type="show">&#xE837;</text>
      </template>
      <template #hide>
        <text class='fu-iconfont2  bandMobile_fd0_3_c1_icon2'  data-type="hide">&#xEBCC;</text>
      </template>
    </benben-flex-password-diy>
</view>
    <view   class='flex align-center justify-center bandMobile_fd0_4'     >
        <button class='bandMobile_fd0_4_c0' @tap.stop="bindMobileFunc()"  >确定</button>
</view>
</view>
        

    
    
    </view>
</template>
<script>
    import {validate} from '@/common/utils/validate.js'
    export default {
        components:{},
        
        
        data(){
			return {"code":"","account":"","userInfo":{"user_token":"","id":"","avatar":"","real_name":"","nickname":"","gender":"","mobile":"","birthday":"","client_id":"","phone":"","email":""},"password":"","extend_info":"","invite_code":"","client_id":"","third_type":""};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
            
		},
		watch:{},
		onLoad(options){
            let {client_id,third_type}=options
if (client_id !== undefined) this.client_id = client_id
if (third_type !== undefined) this.third_type = third_type
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //绑定手机号
                async bindMobileFunc(){
                                if(!validate(this.account,'require')){
                 this.$message.info('手机号不能为空');
                 return false;
            }
            if(!validate(this.account,'phone')){
                 this.$message.info('请输入正确的手机号');
                 return false;
            }
            if(!validate(this.code,'require')){
                 this.$message.info('验证码不能为空');
                 return false;
            }
            if(!validate(this.code,'captcha')){
                 this.$message.info('验证码错误');
                 return false;
            }
            if(!validate(this.password,'require')){
                 this.$message.info('密码不能为空');
                 return false;
            }
            if(!validate(this.password,'password')){
                 this.$message.info('密码不合法(请输入6-12位字母+数字)');
                 return false;
            }
    //请求方法
    //数据验证
    
  let datauserInfo = await this.$api.post(global.apiUrls.post5d7757d28d076, {
    third_type:this.third_type,account_type:'mobile',account:this.account,code:this.code,code_type:'5',extend_info:this.extend_info,client_id:this.client_id,password:this.password,invite_code:this.invite_code
  });
  
  if (datauserInfo.data.code != 1) {
    this.$message.info(datauserInfo.data.msg);
    return
  } 
  let infouserInfo = datauserInfo.data;
  this.userInfo = infouserInfo.data.userinfo
                this.$store.commit('saveToken', this.userInfo.user_token)
                this.$store.commit('updateUserInfo', this.userInfo)
                this.toHomeDiy();
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:var(--benbenbgColor1);background-size: 100% auto !important;
        }
    .bandMobile_fd0_4_c0{
        background:rgba(205,150,45,1);border-radius:44rpx 44rpx 44rpx 44rpx;font-size:32rpx;color:#fff;height:88rpx;line-height:88rpx;font-weight:500;width:638rpx;
    }
    .bandMobile_fd0_4{
        margin:98rpx 0rpx 0rpx 0rpx;
    }
    .bandMobile_fd0_3_c1_icon2{
        text-align:center;font-size:44rpx;
    }
    .bandMobile_fd0_3_c1_icon1{
        text-align:center;font-size:44rpx;font-weight:400;color:rgba(153, 153, 153, 1);
    }
    ::v-deep .bandMobile_fd0_3_c1{
        font-size:28rpx;color:#333;font-weight:400;width:568rpx;
    }
    .bandMobile_fd0_2_c2{
        font-size:28rpx;font-weight:400;color:rgba(0, 91, 196, 1);line-height:40rpx;
    }
    .bandMobile_fd0_2{
        border-bottom:1px solid #eee;padding:40rpx 0rpx 40rpx 0rpx;margin:0rpx 30rpx 0rpx 28rpx;
    }
    .bandMobile_fd0_1_c1{
        line-height:45rpx;font-size:28rpx;font-weight:400;color:#333;
    }
    .bandMobile_fd0_1_c0{
        width:40rpx;height:40rpx;margin:0rpx 22rpx 0rpx 0rpx;
    }
    .bandMobile_fd0_1{
        border-bottom:1px solid #eee;padding:40rpx 0rpx 40rpx 0rpx;margin:-150rpx 30rpx 0rpx 28rpx;
    }
    .bandMobile_fd0_0_c0{
        width:295rpx;height:82rpx;border-radius:0rpx 0rpx 0rpx 0rpx;
    }
    .bandMobile_fd0_0{
        background:url(/static/images/1.png) no-repeat ,transparent;height:600rpx;background-size:100% auto !important;
    }
</style>